package com.redare.dev.smart.generator.workbench.controller;

import com.redare.dev.smart.generator.sdk.GeneratorSysSdk;
import com.redare.dev.smart.generator.sdk.pojo.GeneratorSys;
import com.redare.dev.smart.generator.sdk.pojo.form.GeneratorSysForm;
import com.redare.devframework.common.pojo.CommonResult;
import com.redare.devframework.common.pojo.Page;
import com.redare.devframework.webplatform.workbench.conf.annotations.WebFun;
import com.redare.devframework.webplatform.workbench.controller.component.BaseWebController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 业务系统
 *
 * @date 2021-08-27 15:19:22
 * Created by yangqiangyu
 */


@RequestMapping(value = "/api/_generator_api/generatorSys")
@Controller
public class GeneratorSysController extends BaseWebController {

    @Autowired
    GeneratorSysSdk generatorSysSdk;


    @ResponseBody
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @WebFun(classifyName = "业务系统管理", id = "GeneratorSysAdd", name = "业务系统添加")
    public CommonResult<Boolean> addGeneratorSys(
            @RequestBody GeneratorSysForm.Add form
    ) {
        return generatorSysSdk.addGeneratorSys(form);
    }

    @ResponseBody
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    @WebFun(classifyName = "业务系统管理", id = "GeneratorSysEdit", name = "业务系统编辑")
    public CommonResult<Boolean> editGeneratorSys(
            @RequestBody GeneratorSysForm.Edit form
    ) {
        return generatorSysSdk.editGeneratorSys(form);
    }

    @ResponseBody
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @WebFun(classifyName = "业务系统管理", id = "GeneratorSysDel", name = "业务系统删除")
    public CommonResult<Boolean> deleteGeneratorSys(
            @RequestBody GeneratorSysForm.Del form
    ) {
        return generatorSysSdk.deleteGeneratorSys(form);
    }

    @ResponseBody
    @RequestMapping(value = "/info", method = RequestMethod.POST)
    public CommonResult<GeneratorSys> getGeneratorSys(
            @RequestBody GeneratorSysForm.Get form
    ) {
        return generatorSysSdk.getGeneratorSys(form);
    }


    @ResponseBody
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public CommonResult<Page<GeneratorSys>> findGeneratorSysPage(
            @RequestBody GeneratorSysForm.Search form,
            @RequestParam(value = "curPage", required = false, defaultValue = "1") int curPage,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize
    ) {
        return generatorSysSdk.findGeneratorSysPage(form, curPage, pageSize);
    }


}